package com.ycw.controller.guoguo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ycw.bean.Projects;
import com.ycw.service.guoguo.ProjectReviewService;
import com.ycw.util.Msg;

/**
 * 项目审核功能
 * @author gcz
 *
 */
@Controller
public class ProjectReviewController {
	
	@Autowired
	private ProjectReviewService projectReviewService;
	
	/**
	 * 人工审核项目功能
	 * 根据项目表id得到项目的信息
	 * 包括projects表Users表projectstype表
	 * @param psId 项目id
	 * @return
	 */
	@RequestMapping("getProjectsById")
	@ResponseBody
	public Msg getProjectNotReviewInfoById(Integer psId){
		return projectReviewService.getProjectNotReviewInfoById(psId);
	}
	/**
	 * 人工审核项目功能
	 * 审核成功
	 * 根据项目表id修改项目的信息将未审核改为待上架
	 * @param psId项目id
	 * @return
	 */
	@RequestMapping("projectSuccessful")
	@ResponseBody
	public Msg ProjectAuditSuccessful(Integer psId){
		return projectReviewService.ProjectAuditSuccessful(psId);
	}
	/**
	 * 人工审核项目功能
	 * 审核失败
	 * 根据项目表id修改项目的信息将未审核改为审核失败
	 * @param psId项目id
	 * @return
	 */
	@RequestMapping("projectFailure")
	@ResponseBody
	public Msg ProjectAuditFailure(Integer psId){
		return projectReviewService.ProjectAuditFailure(psId);
	}
	
	/**
	 * 人工审核项目功能
	 * 发送邮件未审核通过原因
	 * 
	 * @param psId根据项目id查找用户id查找邮箱
	 * @param message 未审核原因
	 * @return
	 */
	@RequestMapping("projectFailureMessage")
	@ResponseBody
	public Msg sendMailWhenProjectAuditFailureById(Integer psId, String message){
		return projectReviewService.sendMailWhenProjectAuditFailureById(psId, message);
		
	}
	
	@RequestMapping("onTheProjectById")
	@ResponseBody
	public Msg onTheProjectById(Projects projects){
		return projectReviewService.onTheProjectById(projects);
		
	}
}
